import type { IQuery, TableConfig } from '@/api/config/types';

let queryObj: IQuery<codeQuery> = {
  pageNum: 1,
  pageSize: 10,
  total: 0,
  orderByColumn: 'create_time',
  isAsc: 'desc',
  tableName: '',
};

const resetQuery = () => {
  codeTable.value.query = {
    ...queryObj,
  };
};
export const codeTable = ref<TableConfig>({
  rowKey: 'tableId',
  data: [],
  loading: false,
  moduleName: 'code',
  viewMode: 'table',
  keys: [],
  query: queryObj,
  contextmenu: [],
  reset: resetQuery,
});

interface codeQuery {
  tableName: string;
}

type ViewType = 'IMPORT_DB' | 'DB_TABLE' | 'CONFIG';
/* 切换视图 */
export const genInterface = ref<ViewType>('DB_TABLE');
